package com.b303.dataobject;

import javax.persistence.*;
import java.util.Objects;

@Entity
@Table(name = "order_item", schema = "laowangsongshui", catalog = "")
public class OrderItem {
    private int id;
    private int orderId;
    private int goodId;
    private int amount;

    @Id
    @Column(name = "id")
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "order_id")
    public int getOrderId() {
        return orderId;
    }

    public void setOrderId(int orderId) {
        this.orderId = orderId;
    }

    @Basic
    @Column(name = "good_id")
    public int getGoodId() {
        return goodId;
    }

    public void setGoodId(int goodId) {
        this.goodId = goodId;
    }

    @Basic
    @Column(name = "amount")
    public int getAmount() {
        return amount;
    }

    public void setAmount(int amount) {
        this.amount = amount;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        OrderItem orderItem = (OrderItem) o;
        return id == orderItem.id &&
                orderId == orderItem.orderId &&
                goodId == orderItem.goodId &&
                amount == orderItem.amount;
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, orderId, goodId, amount);
    }
}
